package com.guragura.widget;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.ui.ClickListener;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.guragura.Guragura;
import com.guragura.screens.MainMenuScreen;
import com.guragura.util.Constants;
import com.guragura.util.GuraGameData;

public class ScorePanel extends Dialog {
	
	public int highscore;
	public int score;
	public Guragura guragura;
	
	public Button background ;
	
	
	
	public ScorePanel(float width, float height, Guragura guragura) {
		super(width, height);
		this.guragura = guragura;
		// TODO Auto-generated constructor stub
		
		background = new Button (guragura.atlasInterface.findRegion(Constants.SCORE_SCREEN));		
		background.setClickListener(new ClickListener() {
			
			@Override
			public void click(Actor arg0, float arg1, float arg2) {
				// TODO Auto-generated method stub
				((MainMenuScreen)getGura().mainMenuScreen).hideScorePanel();
				
			}
		});
		
		
		addActor(background);		
	}

	public void setScore(int score) {
		this.highscore = GuraGameData.highscore;		
		this.score = score;		
	}
	
	@Override
	public void draw(SpriteBatch batch, float parentAlpha) {
		// TODO Auto-generated method stub
		super.draw(batch, parentAlpha);
//		guragura.guraFont.drawHS(this.highscore+"",(int) (bintang.x  + bintang.width/2 + 35), 480 / 2 );
		guragura.guraFont.drawHS(this.score+"", (160), 480 / 2 + 50 );
		guragura.guraFont.drawHS(this.highscore+"", (90), 480 / 2 - 90 );
	}
	
	public Guragura getGura() {
		return guragura;
	}

	public ScorePanel getSelf() {
		return this;
	}

}
